<?php echo $this->Html->script(array('print')); ?>
<div class="widget">
    <div class="whead"><h6>VISTA DE IMPRESION</h6><div class="clear"></div></div>
    <fieldset>
        <div id="areaImprimir">

            <?php
            if ($venta['Ventasproducto']['sucursale_id'] == 6)
            {
                echo $this->Html->image('generalInternational.jpg');
            }
            if ($venta['Ventasproducto']['sucursale_id'] == 4)
            {
                echo $this->Html->image('Finisheer.jpg');
            }
            if ($venta['Ventasproducto']['sucursale_id'] == 5)
            {
                echo $this->Html->image('cover-fine.jpg');
            }
            ?>  

            <table width="70%" style="height: 70px; float: right;" border="0" id="miTabla">
                <tr>                 
                    <td rowspan="2" align="center" width="40%"><h2>NOTA DE TRANSFERENCIA</h2></td>
                    <td width="30%"><b>No. <?php echo $venta['Ventasproducto']['codigoventa']; ?></b></td>
                </tr>
                <tr>
                    <td height="21">Fecha: 
                        <?php
                        echo date('d-m-y');
                        ?>   
                    </td>
                </tr>
            </table>            
            <table width="100%" border="0">
                <tr>
                    <td width="70%"><b>TRANFIERE:</b>  <?php echo $venta['Sucursale']['nombre']; ?> <b>&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp; A:</b> <?php echo $venta['Transferida']['nombre']; ?></td>
                    <td width="30%" align="left"></td>
                </tr>
            </table>
            <div style="height: 5px;"></div> 

            <table width="100%" border="1">
                <thead>
                    <tr>
                        <th>CODIGO</th>
                        <th>NOMBRE</th>
                        <th>MICRAJE</th>
                        <th>ALTO</th>
                        <th>PESO</th>                       
                    </tr>
                </thead>
                <tbody>
                    <?php foreach ($productos as $pro): ?>
                        <tr>
                            
                            <td align="center">
                                <div style="font-size: 8pt;">
                                    <?php echo $pro['Cortestubo']['codigo']; ?>
                                </div>
                            </td>
                            <td>                                
                                <div style="font-size: 8pt;">                                    
                                    <?php echo $pro['Tubo']['nombre']; ?>                                    
                                </div>
                            </td>
                            <td align="right">
                                <div style="font-size: 8pt;">
                                    <?php echo $pro['Tubo']['micraje']; ?>
                                </div>
                            </td>
                            <td align="right">
                                <div style="font-size: 8pt;">
                                    <?php echo $pro['Cortestubo']['alto']; ?>
                                </div>
                            </td>
                            <td align="right">
                                <div style="font-size: 8pt;">
                                    <?php echo $pro['Cortestubo']['peso']; ?>
                                </div>
                            </td>                                                                                                           

                        </tr>
                    <?php endforeach; ?>
                </tbody>



            </table>
        </div>
    </fieldset>
</div>
<table>
    <tr>
        <td> 
            <a class="buttonM bBlack" href="#" id="btnImprimir">IMPRIMIR</a>
        </td>
        <td>
            <?php if ($sw == 1): ?>
                <?php echo $this->Html->link('ATRAS', array('action' => 'listatransferencias'), array('class' => 'buttonM bGreen')) ?>
            <?php else: ?>
                <?php echo $this->Html->link('ATRAS', array('action' => 'transferencias', $idventa), array('class' => 'buttonM bGreen')) ?>
            <?php endif; ?>

        </td>


    </tr>

</table>
<script type="text/javascript">

    $(document).ready(function() {

        $("#btnImprimir").click(function() {
            //console.log('click');
            printElem({
                leaveOpen: true,
                printMode: 'popup',
                overrideElementCSS: [
                    '<?php echo $this->webroot; ?>css/imprimir.css',
                    {href: '<?php echo $this->webroot; ?>css/imprimir.css', media: 'print'}]
            });
            //printElem({ overrideElementCSS: ['http://www.imprenta.com/css/printable.css'] });
        });

    });
    function printElem(options) {
        $('#areaImprimir').printElement(options);
    }
</script>